from PyQt4.QtGui import QWidget
from PyQt4 import QtCore,QtGui
import pyqtgraph as pg
from KModel.KSingleStock import KSingleStock
class KChartAxisItem(pg.AxisItem):
	def Initialize(self,stockobject):
	# initialize with the stock object
		self.m_stock=stockobject	
	def tickStrings(self, values, scale, spacing):
		"""Return values describing the desired spacing and offset of ticks.
		
		This method is called whenever the axis needs to be redrawn and is a 
		good method to override in subclasses that require control over tick locations.
		
		The return value must be a list of three tuples::
		
			[
				(major tick spacing, offset),
				(minor tick spacing, offset),
				(sub-minor tick spacing, offset),
				...
			]
		"""
		strns=[]
		if not hasattr(self,'m_stock'):
			return []
		labelarr=self.m_stock.GetDatesByIndex(values)
		strns.extend(labelarr)
		return strns
